"use strict";
const common_vendor = require("../../../common/vendor.js");
const api_police_clock = require("../../../api/police/clock.js");
const stores_userInfo = require("../../../stores/userInfo.js");
if (!Array) {
  const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
  const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
  const _easycom_up_form_item2 = common_vendor.resolveComponent("up-form-item");
  const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
  const _easycom_up_form2 = common_vendor.resolveComponent("up-form");
  const _easycom_up_datetime_picker2 = common_vendor.resolveComponent("up-datetime-picker");
  const _easycom_up_toast2 = common_vendor.resolveComponent("up-toast");
  (_easycom_up_input2 + _easycom_up_icon2 + _easycom_up_form_item2 + _easycom_up_textarea2 + _easycom_up_form2 + _easycom_up_datetime_picker2 + _easycom_up_toast2)();
}
const _easycom_up_input = () => "../../../node-modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_icon = () => "../../../node-modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_up_form_item = () => "../../../node-modules/uview-plus/components/u-form-item/u-form-item.js";
const _easycom_up_textarea = () => "../../../node-modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_form = () => "../../../node-modules/uview-plus/components/u-form/u-form.js";
const _easycom_up_datetime_picker = () => "../../../node-modules/uview-plus/components/u-datetime-picker/u-datetime-picker.js";
const _easycom_up_toast = () => "../../../node-modules/uview-plus/components/u-toast/u-toast.js";
if (!Math) {
  (_easycom_up_input + _easycom_up_icon + _easycom_up_form_item + _easycom_up_textarea + _easycom_up_form + _easycom_up_datetime_picker + _easycom_up_toast)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "fileReport",
  setup(__props) {
    const userInfoStore = stores_userInfo.useUserInfoStore();
    const showStartTime = common_vendor.ref(false);
    const showEndTime = common_vendor.ref(false);
    const formData = common_vendor.reactive({
      value1: Date.now(),
      value2: Date.now(),
      form: {
        reportStartTime: "",
        reportEndTime: "",
        policeUserId: userInfoStore.userInfo.userId,
        reportContent: void 0
      },
      rules: {
        reportStartTime: {
          type: "string",
          required: true,
          message: "请选择开始时间",
          trigger: ["blur", "change"]
        },
        reportEndTime: {
          type: "string",
          required: true,
          message: "请选择结束时间",
          trigger: ["blur", "change"]
        },
        reportContent: {
          type: "string",
          required: true,
          message: "请填写报备内容",
          trigger: ["blur", "change"]
        }
      }
    });
    const { value1, value2, form, rules } = common_vendor.toRefs(formData);
    const uForm = common_vendor.ref(null);
    const uToastRef = common_vendor.ref(null);
    const selectStartTime = (item) => {
      showStartTime.value = false;
      form.value.reportStartTime = common_vendor.dayjs(item.value).format("YYYY-MM-DD HH:mm:ss");
    };
    const selectEndTime = (item) => {
      showEndTime.value = false;
      form.value.reportEndTime = common_vendor.dayjs(item.value).format("YYYY-MM-DD HH:mm:ss");
    };
    const onsubmit = () => {
      uForm.value.validate().then((res) => {
        console.log(form.value);
        api_police_clock.policeReport(form.value).then((res2) => {
          uToastRef.value.show({
            type: "success",
            message: "提交成功"
          });
          let timer = setTimeout(() => {
            common_vendor.index.navigateBack({
              delta: 1
            });
            clearTimeout(timer);
          }, 1500);
        }).catch((err) => {
          uToastRef.value.show({
            type: "error",
            message: err
          });
        });
      }).catch((error) => {
      });
    };
    common_vendor.onReady(() => {
      uForm.value.setRules(rules.value);
    });
    return (_ctx, _cache) => {
      return {
        a: common_vendor.o(($event) => common_vendor.unref(form).reportStartTime = $event),
        b: common_vendor.p({
          disabled: true,
          disabledColor: "#ffffff",
          placeholder: "请选择",
          border: "none",
          color: "#000000",
          inputAlign: "right",
          placeholderStyle: "{color: '#707070'}",
          modelValue: common_vendor.unref(form).reportStartTime
        }),
        c: common_vendor.p({
          name: "arrow-right",
          color: "#000000"
        }),
        d: common_vendor.o(($event) => showStartTime.value = true),
        e: common_vendor.p({
          label: "开始时间",
          borderBottom: true,
          required: true,
          prop: "reportStartTime"
        }),
        f: common_vendor.o(($event) => common_vendor.unref(form).reportEndTime = $event),
        g: common_vendor.p({
          disabled: true,
          disabledColor: "#ffffff",
          placeholder: "请选择",
          border: "none",
          color: "#000000",
          inputAlign: "right",
          placeholderStyle: "{color: '#707070'}",
          modelValue: common_vendor.unref(form).reportEndTime
        }),
        h: common_vendor.p({
          name: "arrow-right",
          color: "#000000"
        }),
        i: common_vendor.o(($event) => showEndTime.value = true),
        j: common_vendor.p({
          label: "结束时间",
          borderBottom: true,
          required: true,
          prop: "reportEndTime"
        }),
        k: common_vendor.o(($event) => common_vendor.unref(form).reportContent = $event),
        l: common_vendor.p({
          placeholder: "可输入100字以内的报备内容",
          count: true,
          height: "180",
          maxlength: 100,
          modelValue: common_vendor.unref(form).reportContent
        }),
        m: common_vendor.p({
          label: "报备内容",
          required: true,
          prop: "reportContent"
        }),
        n: common_vendor.sr(uForm, "1e25206d-0", {
          "k": "uForm"
        }),
        o: common_vendor.p({
          labelPosition: "left",
          model: common_vendor.unref(form),
          rules: common_vendor.unref(rules),
          labelWidth: "75"
        }),
        p: common_vendor.o(onsubmit),
        q: common_vendor.o(selectStartTime),
        r: common_vendor.o(($event) => showStartTime.value = false),
        s: common_vendor.o(($event) => showStartTime.value = false),
        t: common_vendor.o(($event) => common_vendor.isRef(value1) ? value1.value = $event : null),
        v: common_vendor.p({
          show: common_vendor.unref(showStartTime),
          mode: "datetime",
          closeOnClickOverlay: true,
          modelValue: common_vendor.unref(value1)
        }),
        w: common_vendor.o(selectEndTime),
        x: common_vendor.o(($event) => showEndTime.value = false),
        y: common_vendor.o(($event) => showEndTime.value = false),
        z: common_vendor.o(($event) => common_vendor.isRef(value2) ? value2.value = $event : null),
        A: common_vendor.p({
          show: common_vendor.unref(showEndTime),
          mode: "datetime",
          closeOnClickOverlay: true,
          modelValue: common_vendor.unref(value2)
        }),
        B: common_vendor.sr(uToastRef, "1e25206d-11", {
          "k": "uToastRef"
        })
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1e25206d"]]);
wx.createPage(MiniProgramPage);
